package com.ecas.code.generator.service.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * Service层日志拦截器
 *
 * @author
 * @version 1.0
 * @since
 */
@Slf4j
@Aspect
@Component
public class ServiceCostLogAspect {

    /**
     * Pointcut
     *
     */
    @Pointcut("execution(public * com.ecas.code.generator.service.impl.*.*(..))")
    private void aspectjMethod() {
    }

    @Around(value = "aspectjMethod()")
    public Object aroundAdvice(ProceedingJoinPoint pjp) throws Throwable {

        String className = pjp.getTarget().getClass().getName();
        String methodName = pjp.getSignature().getName();
        Object[] args = pjp.getArgs();
        log.info("adviceAround method executing...,className:{},methodName:{}",className,methodName,args);

        return pjp.proceed();
    }
}
